#include "main.h"
#include "dev_uart.h"

//#define UPDATE_IMG
uint32_t NmsCount = 0;
int main(void)
{
    SystemInit();
    sfc_init();
    systick_init();	
	
	  st7789_init();

    SPI_DMA_SendGet_Init();
	    st7789_fill(0,0,360,360,0x0000);//刷黑屏
	
	ST7789_BLK_ON;
    //GPIO_Init(GPIOM,PIN5,1,0,0,0);
		//GPIO_ClrBit(GPIOM,PIN5);
    TimerInit();
    My485_Init();
#ifdef UPDATE_IMG
    while (1 == 1)
    {
        DataDeal_485();
    }
#else

    uart1_init();
    printf("on_boot completed.\n");
	



    show_flag = 1;
    LCD_Test();//播放开机动画
		show_flag = 0;

    while (1)
    {
				DataDeal_485();//UART0升级FLASH处理
        process_rx();
			
				NmsCount++;
				if(NmsCount>=300000)
				{
					NmsCount = 0;
					if(show_flag==0)
					{
						if(mode_state<=1)
							Donghua(Donghua1StartNum,Donghua1Num);
						else if(mode_state==2)
							Donghua(Donghua2StartNum,Donghua2Num);
						else if(mode_state==4)
							Donghua(Donghua3StartNum,Donghua3Num);
						else if(mode_state==3)
							Donghua(Donghua4StartNum,Donghua4Num);
					}
				}
    }
#endif
}

void SysTick_Handler_cb(void)
{
}

void SysTick_Handler(void)
{
    swm_inctick();
    SysTick_Handler_cb();
}
